/*
 * SatelliteTracker.h
 *
 *  Created on: Dec 10, 2014
 *      Authors: Avihay Avitan & Stefan Farcas
 */

#ifndef SATELLITETRACKERSPACE_H_
#define SATELLITETRACKERSPACE_H_
#include "../AntennaControllerBridge/IAntennaControllerBridge.h"
#include "../Satellite/SatelliteAERQueue.h"
#include "../CoreSettings/CoreSettings.h"
#include "../PassLogger/PassLogger.h"
#include <boost/thread.hpp>

#include <vector>

using namespace AntenaControllerSpace;
using namespace SatelliteNameSpace;
using namespace LoggerNameSpace;
using namespace std;
using namespace SettingsSpace;

namespace SatelliteTrackerSpace {

/**
 * SatelliteTracker - provides the ability to connect to antenna controllers, initiating their positions and tracking the satellite position
 */
	class SatelliteTracker {
	public:
		SatelliteTracker();
		~SatelliteTracker();
		bool initiatePosition(SatelliteAER * initAER);
		bool activateAntennas();
		void startTrackingSatellite(SatelliteAERQueue aerQ, long timeToStartWith,PassLogger * passlogger);
		void turnVHFOff();
		void setSBandController(IAntennaControllerBridge * sband);
		void setVHFUHFController(IAntennaControllerBridge * vhfUhf);

	private:
		bool isTimeForInstace(SatelliteAER* instance)throw (boost::thread_interrupted&);
		void checkTrackerWatchDog() throw (boost::thread_interrupted&);
		SatelliteAER *  getNextInstanceByAntennaResolution(SatelliteAER * currentInstance,SatelliteAERQueue * aerQ);
		void reportStatus(PassLogger * passLogger);
		int status;
		Logger * logger;
		IAntennaControllerBridge *sband;
		IAntennaControllerBridge *vhfUhf;
	};

} /* namespace ASatelliteTracker */

#endif /* SATELLITETRACKER_H_ */
